/**
 * JAVACC DEMO 1.0
 */
package com.apache.dict.service.plugins;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.database.constant.Validator;
import com.apache.dict.manager.DataItemManager;

/**
 * description:  获取数据字典信息
 *
 */
public class ViewDictItemPluginImpl implements PluginConnector {

    private DataItemManager dataItemManager;

    /**
     * TODO 简单描述该方法的实现功能（可选）.
     *
     * @see com.apache.api.manager.PluginConnector#execute(com.apache.api.vo.ParamsVo)
     */
    public Object execute(ParamsVo params) throws Exception {
        String cateEname = String.valueOf(params.getParams("cateEname"));
        String itemValue = String.valueOf(params.getParams("itemValue"));
        ResultEntity result = new ResultEntity();

        if (Validator.isNotNull(cateEname) && Validator.isNotNull(itemValue)) {
            params.setMethodKey("ByCateEnameAndItemValue");
            Object obj = dataItemManager.execute(params);
            result.setMessage("查询成功！");
            result.setResult("true");
            result.setEntity(obj);
        } else {
            result.setMessage("参数为空！");
            result.setResult("false");
        }
        return result;
    }

    public void setDataItemManager(DataItemManager dataItemManager) {
        this.dataItemManager = dataItemManager;
    }

}
